import configparser


# pyinstaller -D app.py

def get_task(path):
    config = configparser.ConfigParser()
    config.read(path, encoding='utf-8')
    all_sections = config.sections()
    for task in range(len(all_sections) - 1):
        yield config.items(all_sections[task + 1])


def get_global_attrs(path):
    config = configparser.ConfigParser()
    config.read(path, encoding='utf-8')
    return config.items('user')


def get_wxid(path):
    config = configparser.ConfigParser()
    config.read(path, encoding='utf-8')
    all_sections = config.sections()
    wxids = []
    for task in range(len(all_sections) - 1):
        wxids.append(config.items(all_sections[task + 1])[0][1])
    return wxids
